﻿/*-------------------------------------------------------------------------
* CLR版本:     4.0.30319.42000
* 创建人:      song 
* 创建时间：   2024/7/11 14:57:46
* 功 能：      技能轨道片段
*-------------------------------------------------------------------------*/

using BattleCore.utils;
using ProtoBuf;
using BattleCore.render;
using BattleCore.attribute;

namespace BattleCore.proto
{
    [ProtoContract(SkipConstructor = true)]
    [ProtoInclude(100, typeof(skill_animator_clip))]
    [ProtoInclude(101, typeof(skill_audio_clip))]
    [ProtoInclude(102, typeof(skill_spine_clip))]
    [ProtoInclude(103, typeof(skill_effect_clip))]
    [ProtoInclude(104, typeof(skill_limit_clip))]
    [ProtoInclude(105, typeof(skill_trigger_clip))]
    [ProtoInclude(106, typeof(skill_buff_clip))]
    public abstract class skill_clip
    {
        [ProtoMember(1)]
        public int _startFrame;
        [ProtoMember(2)]
        public int _endFrame;
        [ProtoMember(3)]
        public int _intKey;
        [ProtoMember(4)]
        public string _stringKey;
        public int _lengthFrame
        {
            get { return _endFrame - _startFrame; }
        }

        public abstract render_msg GetRenderMsg();
    }


    [track_register(23f / 255f, 90f / 255f, 160f / 255f, 255f / 255f, ClipObjType.AnimationClip)]
    [ProtoContract(SkipConstructor = true)]
    public class skill_animator_clip : skill_clip
    {
        [ProtoMember(5)] public int _layer;
        public override render_msg GetRenderMsg()
        {
            return new animator_msg()
            {
                _animName = _stringKey,
                _layer = _layer,
            };
        }
    }

    [track_register(255f / 255f, 173f / 255f, 0f / 255f, 255f / 255f, ClipObjType.AudioClip)]
    [ProtoContract(SkipConstructor = true)]
    public class skill_audio_clip : skill_clip
    {
        [ProtoMember(5)] public AudioType _audioType;
        public override render_msg GetRenderMsg()
        {
            return new audio_msg()
            {
                _audioKey = _stringKey,
                _audioType = _audioType,
            };
        }
    }

    [track_register(254f / 255f, 66f / 255f, 2f / 255f, 255f / 255f, ClipObjType.SkeletonDataAsset)]
    [ProtoContract(SkipConstructor = true)]
    public class skill_spine_clip : skill_clip
    {
        [ProtoMember(5)]
        public AnimLayer _layer;
        [ProtoMember(6)]
        public bool _loop;
        public override render_msg GetRenderMsg()
        {
            return new spine_msg()
            {
                _layer = _layer,
                _animName = _stringKey,
                _loop = _loop,
            };
        }
    }

    [track_register(49f / 255f, 177f / 255f, 160f / 255f, 255f / 255f, ClipObjType.GameObject)]
    [ProtoContract(SkipConstructor = true)]
    public class skill_effect_clip : skill_clip
    {
        [ProtoMember(5)] public vector3 _vector3;
        public override render_msg GetRenderMsg()
        {
            return new effect_msg()
            {
                _effectId = _intKey,
            };
        }
    }

    [track_register(177f / 255f, 67f / 255f, 49f / 255f, 255f / 255f, ClipObjType.None)]
    [ProtoContract(SkipConstructor = true)]
    public class skill_limit_clip : skill_clip
    {
        [ProtoMember(5)] public int _limit;
        public override render_msg GetRenderMsg()
        {
            return new limit_msg()
            {
                _limit = _limit,
            };
        }
    }

    [track_register(0f / 255f, 174f / 255f, 38f / 255f, 255f / 255f, ClipObjType.None)]
    public class skill_trigger_clip : skill_clip
    {
        public override render_msg GetRenderMsg()
        {
            throw new System.NotImplementedException();
        }
    }

    [track_register(0f / 255f, 174f / 255f, 38f / 255f, 255f / 255f, ClipObjType.None)]
    public class skill_buff_clip : skill_clip
    {
        public override render_msg GetRenderMsg()
        {
            throw new System.NotImplementedException();
        }
    }
}